package com.sky.financelake.utils;

import com.sky.financelake.bean.dto.QuotationDto;
import com.wordplat.ikvstockchart.entry.Entry;
import com.wordplat.ikvstockchart.entry.EntrySet;

import java.util.List;

public class StockDataParser {

    public static EntrySet parseKLineData(List<QuotationDto> data) {
        final EntrySet entrySet = new EntrySet();

        for (QuotationDto quotationDto : data) {
            float open = quotationDto.getOpenPrice();
            float high = quotationDto.getHighPrice();
            float low = quotationDto.getLowPrice();
            float close = quotationDto.getClosePrice();
            int volume = quotationDto.getVolumn();
            String date = quotationDto.getTradeDate();
            entrySet.addEntry(new Entry(open, high, low, close, volume, date));
        }

        return entrySet;
    }

}
